#pragma once

#include "components.h"
#include "models.h"

#include "qbe/src/ecs/ecs.hpp"

#include "qlib/all.h"
#include "../../state/state.hpp"
#include "../../layout/layout.hpp"
#include "../../utils/kutils.h"
#include "../../undoRedo/undoRedo.hpp"

namespace qbe::LayerRef {
void exit(ecs::Query query, state::AllModeType enter_mode);
void init(entt::registry& reg, ecs::Commands commands, ecs::Query query);

//进入下层业务
void update_enter_ref_cell(entt::registry& ecs_reg, ecs::Query query, ecs::Bus& bus);
//返回上层业务
void update_back_upper_layer(entt::registry& ecs_reg, ecs::Query query, ecs::Bus& bus);

//返回最上层业务
void update_back_top_layer(entt::registry& ecs_reg, ecs::Query query, ecs::Bus& bus);


void post(entt::registry& reg, ecs::Commands commands, ecs::Query query, ecs::Bus& bus);

class LayerRefPlugin : public ecs::Plugin {
 public:
  void build(ecs::App& app) override;
};
}